<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    // 座机号码验证：全国座机号码 两种格式： 010-1234567 或者 0530-12345678
    // 正则里面的正则符合 |
    var reg = /^\d{3}-\d{7}|\d{4}-\d{8}$/;
    var reg = /^\d{3,4}-\d{7,8}$/;
    console.log(reg.test('010-1234567'));
    console.log(reg.test('0530-12345678'));
    console.log(reg.test('05303-12345678'));
    </script>
</body>
</html>